package econosim;

/*
 * An Offer is the first step in a transaction
 * Producers can make offers
 * Consumers can also make offers
 */

public class Offer {
	
	static public enum Type {
		Buy,
		Sell 
	}
	
	private final double price;
	private final double utility;
	private final Type type;
	private final TransActionAgent agent;
    private int time;
	
	public double getUtility() {
		return utility;
	}
    
	public double getPrice() {
		return price;
	}
	
	public double getCost() {
		return price;
	}
	
	public Type getType() {
		return type;
	}
	
	public TransActionAgent getAgent() {
		return agent;
	}

    public int getDuration() {
        return time;
    }
    
    public boolean good() {
        return time > 0;
    }

    public void decrementTime() {
        time -= 1;
    }
	
	public Offer(double utility, double price, Type type, TransActionAgent agent, int duration)
	{
		this.utility = utility;
		this.price = price;
		this.type = type;
		this.agent = agent;
        this.time = duration;
	}
//
//	public void acceptOffer(TransActionAgent offeree) {
//		TransActionAgent seller = type.seller(agent, offeree);
//		TransActionAgent buyer = type.buyer(agent, offeree);
//
//		// complete transaction
//		// does not include any brokerage fees
//
//		Transaction.transact(seller, buyer, good);
//		Transaction.transact(buyer, seller, price);
//	}
}
